package com.david.exception;


import com.david.auth.pojo.result.ABizCode;

/**
 * @deprecated 请使用BusinessRuntimeException
 */
@Deprecated
public class BusinessException extends RuntimeException{

    private static final long serialVersionUID = 496359106148395365L;

    protected ABizCode aBizCode;

    public ABizCode getaResultCode() {
        return aBizCode;
    }

    public BusinessException(Throwable e) {
        super(e);
        this.aBizCode = ABizCode.FAIL;
    }

    public BusinessException(String message, Throwable e) {
        super(message, e);
        this.aBizCode = new ABizCode(ABizCode.FAIL.getCode(),ABizCode.FAIL.getI18nKey(), message);
    }

    public BusinessException(ABizCode bizCode) {
        super(bizCode.getMsg());
        this.aBizCode = bizCode;
    }

    public BusinessException(ABizCode bizCode, String message) {
        super(message);
        this.aBizCode = new ABizCode(bizCode.getCode(),bizCode.getI18nKey(), message);
    }

    public BusinessException(ABizCode bizCode, String message, Throwable throwable) {
        super(message,throwable);
        this.aBizCode = new ABizCode(bizCode.getCode(),bizCode.getI18nKey(), message, throwable);
    }

    public BusinessException(String message) {
        super(message);
        this.aBizCode = new ABizCode(ABizCode.FAIL.getCode(),ABizCode.FAIL.getI18nKey(), message);
    }
}
